package com.api.regression.group.deletegroup;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.test.context.ContextConfiguration;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import com.api.test.AbstractApiTest;
import com.zyncro.api.IGroupApiService;
import com.zyncro.api.exceptions.ZyncroApiException;
import com.zyncro.api.model.ObjectResultApi;

@ContextConfiguration(locations = { "classpath:/group/group-context.xml" })
public class DeleteGroup extends AbstractApiTest {

	@Value("#{editgroups['user.groupCreator'].appId}")
	private String userUrn;

	@Value("#{editgroups['user.groupCreator'].password}")
	private String userPassword;

	private String groupUrn;

	@BeforeClass
	protected void setParameters() throws Exception {

		getApi().login(userUrn, userPassword);

		ObjectResultApi<String> result = getApi().getService(IGroupApiService.class).createGroup("New Group", "hu", false, false, false,
				false, false, false, false, null);
		this.groupUrn = result.getObject();
	}

	@Test
	public void testGetGroups() throws ZyncroApiException {

		getApi().getService(IGroupApiService.class).deleteGroup(groupUrn);
	}
}
